package com.minimalist.common.entity.basic.po;

import com.mybatisflex.annotation.Column;
import com.mybatisflex.annotation.Table;
import com.minimalist.common.config.mybatis.InsertFullColumnHandler;
import com.minimalist.common.config.mybatis.UpdateFullColumnHandler;
import com.minimalist.common.config.mybatis.bo.BaseEntity;


import java.io.Serial;
import java.io.Serializable;

/**
 * 角色表 实体类。
 *
 * @author 小太阳
 * @since 2024-10-18
 */

@Table(value = "m_role", onInsert = InsertFullColumnHandler.class, onUpdate = UpdateFullColumnHandler.class)
public class MRole extends BaseEntity implements Serializable{

    public MRole() {
    }

    public MRole(Long roleId, String roleName, String roleCode, Integer roleSort, Integer status, String remark, Long tenantId) {
        this.roleId = roleId;
        this.roleName = roleName;
        this.roleCode = roleCode;
        this.roleSort = roleSort;
        this.status = status;
        this.remark = remark;
        this.tenantId = tenantId;
    }

    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    public String getRoleName() {
        return roleName;
    }

    public void setRoleName(String roleName) {
        this.roleName = roleName;
    }

    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = roleCode;
    }

    public Integer getRoleSort() {
        return roleSort;
    }

    public void setRoleSort(Integer roleSort) {
        this.roleSort = roleSort;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Long getTenantId() {
        return tenantId;
    }

    public void setTenantId(Long tenantId) {
        this.tenantId = tenantId;
    }

    public static MRoleBuilder builder() {
        return new MRoleBuilder();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        if (!super.equals(o)) return false;
        MRole mRole = (MRole) o;
        return java.util.Objects.equals(roleId, mRole.roleId) &&
               java.util.Objects.equals(roleName, mRole.roleName) &&
               java.util.Objects.equals(roleCode, mRole.roleCode) &&
               java.util.Objects.equals(roleSort, mRole.roleSort) &&
               java.util.Objects.equals(status, mRole.status) &&
               java.util.Objects.equals(remark, mRole.remark) &&
               java.util.Objects.equals(tenantId, mRole.tenantId);
    }

    @Override
    public int hashCode() {
        return java.util.Objects.hash(super.hashCode(), roleId, roleName, roleCode, roleSort, status, remark, tenantId);
    }

    public static class MRoleBuilder {
        private Long roleId;
        private String roleName;
        private String roleCode;
        private Integer roleSort;
        private Integer status;
        private String remark;
        private Long tenantId;

        public MRoleBuilder roleId(Long roleId) {
            this.roleId = roleId;
            return this;
        }

        public MRoleBuilder roleName(String roleName) {
            this.roleName = roleName;
            return this;
        }

        public MRoleBuilder roleCode(String roleCode) {
            this.roleCode = roleCode;
            return this;
        }

        public MRoleBuilder roleSort(Integer roleSort) {
            this.roleSort = roleSort;
            return this;
        }

        public MRoleBuilder status(Integer status) {
            this.status = status;
            return this;
        }

        public MRoleBuilder remark(String remark) {
            this.remark = remark;
            return this;
        }

        public MRoleBuilder tenantId(Long tenantId) {
            this.tenantId = tenantId;
            return this;
        }

        public MRole build() {
            return new MRole(roleId, roleName, roleCode, roleSort, status, remark, tenantId);
        }
    }

    @Serial
    private static final long serialVersionUID = 1L;

    /**
     * 角色ID
     */
    private Long roleId;

    /**
     * 角色名称
     */
    private String roleName;

    /**
     * 角色编码
     */
    private String roleCode;

    /**
     * 显示顺序
     */
    private Integer roleSort;

    /**
     * 状态  0禁用 1正常
     */
    private Integer status;

    /**
     * 备注
     */
    private String remark;

    /**
     * 租户编号
     */
    @Column(tenantId = true)
    private Long tenantId;

}
